package com.yanmushi.ms.client.controller;

import com.yanmushi.ms.client.model.TestProperties;
import com.yanmushi.ms.client.service.HelloService;
import com.yanmushi.ms.client.service.MyDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author yinlei
 * @Date 2018/3/27
 * @Desc todo
 */
@RestController
public class IndexController {

    @Autowired
    HelloService helloService;
    @Autowired
    TestProperties testProperties;
    @Autowired
    MyDataService myDataService;

    @GetMapping("/")
    public String index() {
        return helloService.index();
    }

    @GetMapping("/hello")
    public String hello() {
        return "client invoke : " + helloService.hello() + ", and the config: " + testProperties.getName();
    }

    @GetMapping("/qq")
    public String qq(Integer id) {
        myDataService.get(id);
        myDataService.get(id);
        return myDataService.get(id);
    }
}
